<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class AdminController extends AppController {

    var $name = 'Admin';
    var $components = array('Auth');
    function index() {
        
        $this->layout = 'admin';
        
    }
    function beforeFilter() {
        $this->Auth->userModel = 'Admin';
        $this->Auth->loginAction = array('controller' => 'admin', 'action' => 'login');
        $this->Auth->loginRedirect = array('controller' => 'admin', 'action' => 'index'); //action se chuyen den sau khi logi
        $this->Auth->authorize = 'controller';
        $this->Auth->loginError = 'Failed to login'; //thong bao dang nhap bi lo
        $this->Auth->authError = 'Access denied'; //thong bao truy cap khong dung khu vuc            
         $this->Auth->allow('index', 'view');
        $this->Auth->fields = array(
            'username' => 'username',
            'password' => 'password'
        );
      
    }
    function login() {
        $this->layout = 'ajax';
    }

}

?>
